package ch.hslu.hs12.dmg;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public abstract class Connector {

	public static Connection connect() {
		Connection conn = null;

		try {
			Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");

			conn = DriverManager
					.getConnection(
							"jdbc:sqlserver://localhost\\dmg2012;Database=dmg_project",
							"sa", "DMG2012GR09");
			conn.setAutoCommit(false);

		} catch (ClassNotFoundException e) {
			System.out.println("Could not find class");
			e.printStackTrace();
		} catch (SQLException e) {
			System.out.println("Could not connect to the database");
			e.printStackTrace();
		}
		return conn;
	}

}
